package org.tracy.timewindow;

import java.util.Date;

/**
 * Created by dinghaiyun on 2016/11/29.
 */
public class TimeWindow implements Comparable{
    private Long time;
    private Object object;

    public Long getTime() {
        return time;
    }

    public void setTime(Long time) {
        this.time = time;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    @Override
    public String toString() {

        StringBuffer sb = new StringBuffer();
        sb.append(", time: " + new Date(this.time) + " , "+this.time);
        return sb.toString();
    }

    @Override
    public int compareTo(Object o) {
        TimeWindow dto = (TimeWindow) o;
        return this.time - dto.getTime()>0?1:this.time - dto.getTime() == 0 ? 0: -1;
    }
}
